package com.eastfair.venuebooking.vo;

import com.eastfair.annotation.annotation.dictionary.DictionaryField;
import com.eastfair.annotation.annotation.vo.VoInfo;
import com.eastfair.venuebooking.demand.ContactGroup;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;

/**
 * 联系人 VO.
 *
 * @author dqq
 * @date 2022 /6/13
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString(callSuper = true)
@Accessors(chain = true)
public class ContactVO implements Serializable {

    private Map<String, Object> echoMap = new HashMap<>();

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {ContactGroup.QueryContact.class})
    private Long id;

    /**
     * 联系人名称
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {ContactGroup.QueryContact.class})
    private String contactName;

    /**
     * 性别，尊称
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {ContactGroup.QueryContact.class})
    private String gender;

    /**
     * 角色
     */
    @DictionaryField(type = "CONTACT_ROLE")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {ContactGroup.QueryContact.class})
    private String role;

    /**
     * 生日
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {ContactGroup.QueryContact.class})
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private LocalDate birthday;

    /**
     * 岗位
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {ContactGroup.QueryContact.class})
    private String post;

    /**
     * 手机号
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {ContactGroup.QueryContact.class})
    private String mobile;

    /**
     * 固定电话
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String phone;

    /**
     * 传真
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String fax;

    /**
     * 邮箱
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String mail;

    /**
     * 微信账号
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String wechat;

    /**
     * qq号
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String qq;

    /**
     * 所在地区
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String region;

    /**
     * 详细地址
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String address;

    /**
     * 备注
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String remark;

    /**
     * cms系统同步状态 0:待同步;1:已同步
     */
    @ApiModelProperty(value = "cms系统同步状态 0:待同步;1:已同步")
    @NotNull(message = "请填写cms系统同步状态 0:待同步;1:已同步")
    private Integer cmsSync;

    /**
     * 客户id
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {ContactGroup.QueryContact.class})
    private Long customerId;

    /**
     * 客户名称
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {ContactGroup.QueryContact.class})
    private String customerName;

    /**
     * 最后联系时间
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {ContactGroup.QueryContact.class})
    private String lastContactTime;

    /**
     * 是否是主要联系人
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @VoInfo(groups = {ContactGroup.QueryContact.class})
    private Boolean important;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Long createdBy;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String createdByName;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Long updatedBy;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String updatedByName;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    protected LocalDateTime updateTime;
}
